# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-pytap2
pkgver=2.3.0
pkgrel=0
pkgdesc="Object oriented interface to Linux Tun/Tap devices"
url="https://github.com/johnthagen/pytap2/"
arch="noarch"
license="MIT"
depends="net-tools"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="py3-pytap2-$pkgver.tar.gz::https://github.com/johnthagen/pytap2/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/pytap2-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 README.rst -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
3b5640f54b43b7350262bec09b744eca6f435564d1dc18d1228043eddf490ff4014689426e3015e3bd21890e66f274708aaabe9732bfb5deea8732c8e7f2e6d1  py3-pytap2-2.3.0.tar.gz
"
